import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/celery-member/member/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/celery-member/member/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/celery-member/member/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/celery-member/member/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/celery-member/member/submit',
    method: 'post',
    data: row
  })
}

export const savePackagesCycle = (memberId, packagesCycle) => {
  return request({
    url: '/api/celery-member/member/save-packages-cycle',
    method: 'post',
    data: {
      memberId,
      packagesCycle
    }
  })
}

export const isStopChange = (memberId) => {
  return request({
    url: '/api/celery-member/member/is-stop-change',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const isFreshChange = (memberId) => {
  return request({
    url: '/api/celery-member/member/is-fresh-change',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const notPepperChange = (memberId) => {
  return request({
    url: '/api/celery-member/member/not-pepper-change',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const notCorianderChange = (memberId) => {
  return request({
    url: '/api/celery-member/member/not-coriander-change',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const notTablewareChange = (memberId) => {
  return request({
    url: '/api/celery-member/member/not-tableware-change',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const changeNotified = (memberId) => {
  return request({
    url: '/api/celery-member/member/change-notified',
    method: 'post',
    params: {
      memberId
    }
  })
}

export const addExemptTime = (memberId, time) => {
  return request({
    url: '/api/celery-member/member/add-exempt-time',
    method: 'post',
    params: {
      memberId,
      time
    }
  })
}

export const addExemptTimeBatch = (memberIds, time) => {
  return request({
    url: '/api/celery-member/member/add-exempt-time-batch',
    method: 'post',
    params: {
      memberIds,
      time
    }
  })
}

export const syncPackagesCount = () => {
  return request({
    url: '/api/celery-member/member/sync-packages-count',
    method: 'post',
  })
}

export const scheduleActive = (memberId) => {
  return request({
    url: '/api/celery-member/member/packages-cycle-active',
    method: 'post',
    params: {
      memberId,
    }
  })
}

export const resetPassword = (memberIds) => {
  return request({
    url: '/api/celery-member/member/reset-password',
    method: 'post',
    params: {
      memberIds,
    }
  })
}

